<template>
    <div class="card" v-if="user" >
    <div class="card-img-top text-center"  alt="Card image cap">
        <img :src="user.headImg" class="rounded-circle ma" width="104" height="104"   alt="">
    </div>
    <div class="card-header  bg-white text-center">
        <span v-text="user.userName" ></span>
  </div>
    <div class="card-body alert alert-success">
        <p> <i class="el-icon-info" ></i> &nbsp; <span v-text="user.userType" ></span></p>
        <p> <i class="el-icon-location"></i> &nbsp; <span ></span> </p>
        <p> <i class="el-icon-phone"></i> &nbsp; <span v-text="user.phoneNum" ></span> </p>
        <hr>
    </div>
  </div>
</template>

<script>
import { asyncgetUserByUser } from "../plugins/api.js";

export default {
  data() {
    return {
      user: null
    };
  },
  mounted() {
      this.start()
  },
  methods: {
    async start() {
      let id = this.$attrs.userId;
      try {
        this.user = await asyncgetUserByUser({userId:id});
        console.log(this.user)
      } catch (err) {
        console.log(err);
      }
    }
  }
};
</script>

<style scoped>
.ma {
    margin-top: 20px;
    margin-bottom: 20px;
}
</style>
